#include <stdio.h>
#include <math.h>
#include "user.h"
#include "user_doe.h"

static double h,w;
double s;

double UserNS1Fun(double u, double v) {
float u1, res=0;
int priznak,number;
u1=u+h/2;
priznak=u1/11;
number=u1-(11*priznak);
if(number==0) res=M_PI;
if(number==1) res=M_PI;
if(number==2) res=M_PI;
if(number==3) res=M_PI;
return res;
}

void UserNonSymm1()   {
   char *InputValues[3];
   char *Title={"   DOE : User NonSymmetric N1"};

   char *ParNames[]={
		     "Hight              :",
		     "Width              :",
		     "Discretization Step:"
		     };

   char *Default[]={
		    "    60        ",
		    "    60        ",
		    "    1         "
		    };
   if(!sedit(25,4,3,ParNames,InputValues,Default,Title))  return ;

   // read input data

   sscanf(InputValues[0],"%lf \0",&h);
   sscanf(InputValues[1],"%lf \0",&w);
   sscanf(InputValues[2],"%lf \0",&s);
  // sscanf(InputValues[4],"%lf \0",&b);


   // max&min values of phase in this mask
   double max=M_PI;
   double min=0;
   NonSymmetricDOE(Phase, max, min, UserNS1Fun);

   // control the DOE sizes and output they to InfoWindow
   // if sizes wrong (very big) - return
   if(MessageSize(w, h, s)) return;
   // Output information to InfoWindow
   MessageName("NonSymmetric DOE N1");  // write title
   MessageParam(1,"   AMPLITUDE MASK ");
   MessageParam(2,"Hight  %f",h);
   MessageParam(3,"Width  %f",w);
   MessageParam(4,"Step   %f",s);
   MessageOut();                  // output all string to InfoWindow
   UndoMenu(3) ;   //  delete 3 last level submenu on the screen
   return;
}
